package com.qf.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.dao.JudgeQuestionDao;
import com.qf.entity.TbChoiceQuestion;
import com.qf.entity.TbJudgeQuestion;
import com.qf.service.JudgeQuestionService;
import com.qf.utils.ResultMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class JudgeQuestionServiceImpl extends ServiceImpl<JudgeQuestionDao, TbJudgeQuestion> implements JudgeQuestionService {

    @Autowired(required = false)
    ResultMsg resultMsg;

    @Autowired(required = false)
    JudgeQuestionDao judgeQuestionDao;

    @Override
    public ResultMsg addJudgeQuestion(TbJudgeQuestion tbJudgeQuestion) {
        int insert = judgeQuestionDao.insert(tbJudgeQuestion);
        if (insert==1)
            return resultMsg.success();
        return resultMsg.faild(300,"添加判断题失败");
    }

    @Override
    public ResultMsg selsctJudgeOne() {
        TbChoiceQuestion judgeById = judgeQuestionDao.findJudgeById();
        return resultMsg.success(judgeById);
    }
}
